home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
a_utils
/
decomp.lha
/
decomp
/
nodes.h
< prev
next >
Wrap
C/C++ Source or Header
|
1988-01-12
|
3KB
|
99 lines
/*
* Module: nodes.h
*
* Author: J. Reuter
*
* This module defines the structures and constants used to build
* nodes of basic blocks and structured blocks. These are used
* by the structuring code.
*/
/* basic block node types */
#define N_UNREACH 0
#define N_FLOW 1
#define N_BRANCH 2
#define N_CASE 3
#define N_END 4
#define N_IF 5
/* structuring node types */
#define N_LOOP 6
#define N_ITER 7
#define N_ANDIF 8
#define N_ORIF 9
#define N_SWITCH 10
#define N_GOTO 11
#define N_BREAK 12
#define N_CONTINUE 13
#define N_CASELAB 14
#define N_WHILE 15
#define N_UNTIL 16
#define MAX_TYPES 17
#define MAX_CHILD 2
#define MAX_VAR 4
/*
* Static information describing the node information
*/
struct node_info {
int num_children; /* number of children in tree structure */
char *name; /* symbolic name of node type */
};
/*
* The node structure is constructed to hold the basic blocks.
* It is then munged by the structuring code to hold the program
* heirarchy.
*/
struct node {
int node_type; /* see note types above */
address start_address; /* beginning code address of this block */
address end_address; /* end code address ... */
int num_arcs; /* number of node exit arcs */
address *arcs; /* pointer to array of node exit arcs */
union { /* a scratch area, used many ways */
int scratch;
struct node *pscratch;
} node_un;
int right_sibling; /* right sibling of node in hier. */
int reach;
int child[MAX_CHILD]; /* children of node in hier. */
int varpart[MAX_VAR]; /* variant use fields */
};
#define node_scratch node_un.scratch
#define node_pscratch node_un.pscratch
#define NONE -1 /* empty arc (0 is a legal address) */
#define DEFINED( N ) ( N >= 0 )
/* N_ITER variant parts */
#define V_NEXT 0 /* N_THEN condition for iteration for WHILE or UNTIL */
#define V_FATHER 1 /* father of v */
/* N_WHILE, N_UNTIL variant parts */
#define V_LOOP_PRED 2 /* loop predicate */
/* N_IF, N_THEN parts */
#define V_NEGATE 0 /* TRUE if predicate negated */
#define V_PRED1 1 /* predicate 1 for N_ANDIF, N_ORIF */
#define V_PRED2 2 /* predicate 2 for N_ANDIF, N_ORIF */
#define THEN_ARC 1 /* arc number of true branch */
#define ELSE_ARC 0 /* arc number of false branch */
/* N_CASELAB parts */
#define V_CASESLOT 0 /* branch slot in case instruction */
/* N_CASE parts */
#define V_BASE 0 /* case instruction base operand */
#define V_LIMIT 1 /* case instruction limit operand */
extern int node_count;
extern int node_max;
extern struct node **node_array;
extern struct node_info node_info[MAX_TYPES];
extern struct node *get_node();